package com.hspedu.homework;

import com.hspedu.poly_.polyparameter.Manager;

public class Homework04 {
    public static void main(String[] args) {
        Worker emp1 = new Worker("小龙", 300, 30, 1.0);
        emp1.printSal();
        Manger emp2 = new Manger("小马", 300, 30, 1.2,1000);
        emp2.printSal();
    }
}

class Employee {
    private String name;
    private double daySal;//单日工资
    private int workDays;//工作天数
    private double grade;

    public void printSal() {
        System.out.println("普通员工 "+name + "工作"+ workDays+"天的工资为：" + daySal * grade * workDays);
    }

    public Employee(String name, double daySal, int workDays, double grade) {
        this.name = name;
        this.daySal = daySal;
        this.workDays = workDays;
        this.grade = grade;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getDaySal() {
        return daySal;
    }

    public void setDaySal(double daySal) {
        this.daySal = daySal;
    }

    public int getWorkDays() {
        return workDays;
    }

    public void setWorkDays(int workDays) {
        this.workDays = workDays;
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(double grade) {
        this.grade = grade;
    }
}

class Manger extends Employee {
    private double bonus;

    @Override
    public void printSal() {
        System.out.println("项目经理 "+getName() + "工作"+ getWorkDays()+"天的工资为："
                + (bonus+  getGrade() * getWorkDays() *getDaySal()));
    }

    public Manger(String name, double daySal, int workDays, double grade, double bonus) {
        super(name, daySal, workDays, grade);
        setBonus(bonus);
    }

    public double getBonus() {
        return bonus;
    }

    public void setBonus(double bonus) {
        this.bonus = bonus;
    }
}

class Worker extends Employee{

    public Worker(String name, double daySal, int workDays, double grade) {
        super(name, daySal, workDays, grade);
    }

    @Override
    public void printSal() {
        super.printSal();
    }
}